$('.edit').click(function(){
	$('.default').remove();
	$(this).parents('li').find('.top').append($('<div class="default">默认</div>'))
})
$('.remove').click(function(){
	$(this).parents('li').remove();
})
$.getJSON('/api/address/list',function(res){
	if(res.status){
		var html='';
		res.data.forEach(function(item,index){
			html+=`<li>
				<div class="info">
					<div class="top">
						<span class="name">${item.name}</span>
						<span class="tel">${item.tel}</span>
						<div class="default">默认</div>
					</div>
						<div class="detail">
							${item.province_name}${item.city_name}${item.county_name}${item.street}${item.town_name}
						</div>
				</div>
				<a href='./editaddress.html'><img class="edit" src="./img/receiveraddress_img/edit.png" alt=""></a>
				<img class="remove" src="./img/receiveraddress_img/remove.png" alt="">
			</li>`
		})
		$('.address-list').html(html);
	}
	
})